|
|
|
|
|
|
|
Figure 4.4.
Setting a menu list on the Toolbar
button property page. |
|
|
|
|
|
|
|
|
Figure 4.5.
Using drop-down menus from a toolbar. |
|
|
|
|
|
|
|
|
After adding the buttons to your toolbar, you can click OK to close the Property Pages dialog box. You form should now look like the one in Figure 4.6. |
|
|
|
|
|
|
|
|
Figure 4.6.
The final project form with the Toolbar
and ImageList controls set. |
|
|
|
|
|
|
|
|
You now have a toolbar on your form. If you execute the application, you can click the buttons and see that they respond. Until you add some code to the toolbar's events, however, the buttons won't perform any functions. The buttons of the toolbar don't have any events of their own. Instead, ButtonClick is the toolbar event in which you'll place your button code. This event passes a button object to the event procedure, which identifies the button pressed. In your code, you'll use the value of the Key property to determine which button was actually pressed. The following source code is typical for taking actions based on buttons pressed: |
|
|
|
|
|